// 中文 utf8
#ifndef _AOI_H_LX22
#define _AOI_H_LX22

#ifdef WIN32
#define AOI_EXPORT __declspec( dllexport )
#else
#define AOI_EXPORT
#endif

typedef unsigned int engine_id_t;

#define INVALID_ENGINE_ID         ((engine_id_t)0)

#define AOI_REL_ThisCanSeeOther   0x01
#define AOI_REL_OtherCanSeeThis   0x02

#define AOI_REL_InAxisRange       0x04

#define AOI_REL_ThisEnterOtherAOI 0x10
#define AOI_REL_OtherEnterThisAOI 0x20
#define AOI_REL_ThisLeaveOtherAOI 0x40
#define AOI_REL_OtherLeaveThisAOI 0x80


#if defined (__cplusplus)
extern "C" {
#endif

typedef int (*cb_a_enter_aoi_of_b)(void * p_aoi_mgr, engine_id_t a, engine_id_t b);
typedef int (*cb_a_leave_aoi_of_b)(void * p_aoi_mgr, engine_id_t a, engine_id_t b);
typedef int (*cb_a_batch_enter_leave_aoi)(void * p_aoi_mgr, engine_id_t a, int enter_size, engine_id_t * enter_fid, int leave_size, engine_id_t * leave_fid);

typedef int (*cb_aoi_iterate)(void * p_aoi_mgr, engine_id_t a, engine_id_t b); // a can see b

AOI_EXPORT void * create_aoi_mgr(void * p_user_data, cb_a_enter_aoi_of_b a_enter_aoi_of_b, cb_a_leave_aoi_of_b a_leave_aoi_of_b, cb_a_batch_enter_leave_aoi a_batch_enter_leave_aoi, float aoi_deviation, bool enable_max_aoi_range_check);

AOI_EXPORT void free_aoi_mgr(void * p_aoi_mgr);

AOI_EXPORT void * aoi_mgr_get_user_data(void * p_aoi_mgr);

AOI_EXPORT int aoi_set_aoi_deviation(void * p_aoi_mgr, float new_aoi_deviation);

AOI_EXPORT int aoi_add_obj_to_scene(void * p_aoi_mgr, engine_id_t engine_id, float x, float y, float z, float aoi_range);

AOI_EXPORT int aoi_remove_obj_from_scene(void * p_aoi_mgr, engine_id_t engine_id);

AOI_EXPORT int aoi_move_obj(void * p_aoi_mgr, engine_id_t engine_id, float new_x, float new_y, float new_z);

AOI_EXPORT int aoi_set_obj_aoi_range(void * p_aoi_mgr, engine_id_t engine_id, float new_aoi_range);

AOI_EXPORT int aoi_get_obj_info(void * p_aoi_mgr, engine_id_t engine_id, float * p_aoi_range, float * p_x, float * p_y, float * p_z, float * p_aoi_x, float * p_aoi_y, float * p_aoi_z);

AOI_EXPORT int aoi_iterate_this_see(void * p_aoi_mgr, engine_id_t engine_id, cb_aoi_iterate iterate_func);

AOI_EXPORT int aoi_iterate_see_this(void * p_aoi_mgr, engine_id_t engine_id, cb_aoi_iterate iterate_func);

AOI_EXPORT int aoi_get_see_rel(void * p_aoi_mgr, engine_id_t a, engine_id_t b); // a: this, b: other

AOI_EXPORT int aoi_set_relation(void * p_aoi_mgr, engine_id_t a, engine_id_t b, int rel); // a: this, b: other

#if defined (__cplusplus)
}
#endif

#endif

